def save_cookie(cookie):
    with open('douban.cookie','w',newline='',encoding='utf-8') as f:
        f.write(cookie)

def get_noc_headers(referer=''):
    headers = {
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0'
    }
    if referer: headers['referer'] = referer
    return headers

def get_cookies_headers(referer=''):
    headers = {
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0'
    }
    if referer: headers['referer'] = referer
    with open('douban.cookie', 'r') as f:
        headers['cookie'] = f.read()
    return headers

if __name__ == '__main__':
    cookie='bid=1-CVcmcsUV4; ll="118352"; _pk_id.100001.4cf6=b269a1f0f18e46b3.1752051577.; __yadk_uid=eS2FqKNQjkBcnF9BsbfC0mxjezF0v9t5; _vwo_uuid_v2=D3E660B73BEE93E6E2AF5B03283802361|eb58702d439b0f7892da7cef26fbe9fb; push_doumail_num=0; __utmv=30149280.229; push_noty_num=0; __utmz=30149280.1752723718.15.4.utmcsr=accounts.douban.com|utmccn=(referral)|utmcmd=referral|utmcct=/; _ga=GA1.1.1607071318.1753065042; _sharedID=019f3049-47d2-4967-aa11-1e719a00a1ab; _cc_id=fe5b17a63f8337b82cda83561d2b7434; panoramaId_expiry=1753669851973; panoramaId=6912163bf32546e726c58d9f4f75185ca02c18a2d0cb120bc8f7f85967a8eabd; panoramaIdType=panoDevice; __gads=ID=23eeca7f3d714d8f:T=1752891156:RT=1753070783:S=ALNI_Ma6O8nljNRK8h2r0TacZyjEouMpjQ; __gpi=UID=00001168cefb9eb0:T=1752891156:RT=1753070783:S=ALNI_MbSnz2Q25-eTHrq-nCrDFMgC3bjaA; __eoi=ID=ffdd86f013ef2c1e:T=1752891156:RT=1753070783:S=AA-AfjbJCp6xDxJkckgp4ZiZ4dif; _sharedID_cst=kSylLAssaw%3D%3D; _ga_P83QWMDYS1=GS2.1.s1753070340$o3$g1$t1753070783$j60$l0$h0; FCNEC=%5B%5B%22AKsRol9RHtp17S8Xtc2xovN_MOutA_XiWd5UYfNFeZQS9I6DHEE08MTzIYig9UESqC1bSSITZp038WM8ON986dTCnS4mRDqSA8_oZSvON3Q1OjCe-6Q1z4ijUm6isfYD9-unzwom6TRfOcw1k44h4kp5RW7WlNWTqw%3D%3D%22%5D%5D; cto_bundle=2lM6LF82SENQTkt3OSUyRm9WMTNCN0hndjdLMTk5amhlSTRsdElzaEdzOWRBV1V6UzBoMW1oOGp1NEx6RHBld05aQVRDbk9QbTBWV0dYRHc1dkNlU1V0Z2VCNm1VMXFvblNQb0RKQlIlMkJlYTFJZWEyN284UzVEeSUyRjdpcnJNTCUyRnRVbzNIdyUyRm1oJTJGcTdrZUFYYVdKSjBKOUN0WHFqRVElM0QlM0Q; cto_bidid=Z5yAqF95TnhSRTY1N1ZXMDlSZGd1Q2lURU9FQng1dVZOcHA2QVNWMjg2WUtCbVpiTWU1c2ZCUExKV1I5d1JzUzhjJTJCdGs1ZzdBTjV0ZEU2ekNEWEJQU1lZZFp0eGNuNml6VTY3OUM5YVNQdiUyRkJvTDAlM0Q; ct=y; ap_v=0,6.0; __utma=30149280.1156231821.1752051574.1753139046.1753151582.26; __utmc=30149280; __utmt=1; dbcl2="2291925:LI0jb7dwGI4"; ck=ehoA; frodotk_db="ca3dd14918ec153e5eb973db4ac43fba"; __utmb=30149280.9.10.1753151582; __utma=223695111.1892684186.1752051577.1753065045.1753151825.20; __utmb=223695111.0.10.1753151825; __utmc=223695111; __utmz=223695111.1753151825.20.9.utmcsr=douban.com|utmccn=(referral)|utmcmd=referral|utmcct=/people/ynkonghao/; _pk_ref.100001.4cf6=%5B%22%22%2C%22%22%2C1753151825%2C%22https%3A%2F%2Fwww.douban.com%2Fpeople%2Fynkonghao%2F%3F_i%3D31517661-CVcmc%22%5D; _pk_ses.100001.4cf6=1'
    save_cookie(cookie)